import { lazy } from "react";
import { createBrowserRouter } from 'react-router-dom'
import {
    UploadOutlined,
    UserOutlined,
    VideoCameraOutlined,
} from '@ant-design/icons';

const App = lazy(() => import('../App'))
const Home = lazy(() => import('../pages/home/Index'))
const Home1 = lazy(() => import('../pages/home/home1/Index'))
const List = lazy(() => import('../pages/list/Index'))
const User = lazy(() => import('../pages/user/Index'))

type homeRouter = {
    path: string;
    element: JSX.Element;
    children?: homeRouter;
    icon?: any;
    label?: string;
}[]

export const homeRoutes: homeRouter = [
    {
        path: '/home',
        element: <Home></Home>,
        icon: <UploadOutlined />,
        label: '首页',
        children: [
            {
                path: '/home/home1',
                element: <Home1></Home1>,
                icon: <VideoCameraOutlined />,
                label: '首页111',
            }
        ]
    },
    {
        path: '/user',
        element: <User></User>,
        icon: <UserOutlined />,
        label: '用户'
    },

]

const routes: homeRouter = [
    {
        path: '/',
        element: <App></App>,
        children: homeRoutes
    },
    {
        path: '/list',
        element: <List></List>,
    },
]

const router = createBrowserRouter(routes)

export default router